fix: dev_mode SimpleGuard skips agent-card.json, add client.guard property#73
fix: dev_mode SimpleGuard skips agent-card.json, add client.guard property#73beonde wants to merge 3 commits into
Conversation
…perty - Reorder _resolve_identity() so dev_mode (Case 3) takes priority over legacy agent-card.json loading (now Case 4). An A2A agent-card.json without public_keys no longer crashes SimpleGuard in dev_mode. - Skip directory walking in _resolve_project_root() when dev_mode=True - Add guard @Property on AgentIdentity for CapiscIO.connect() result
|
✅ Documentation validation passed!
|
|
✅ All checks passed! Ready for review. |
|
✅ SDK server contract tests passed (test_server_integration.py). Cross-product scenarios are validated in capiscio-e2e-tests. |
There was a problem hiding this comment.
Pull request overview
This PR improves developer experience around SimpleGuard(dev_mode=True) by avoiding failures when agent-card.json is not present, adds a convenience accessor for obtaining a SimpleGuard from CapiscIO.connect() results, and bumps the SDK version to 2.7.2.
Changes:
- Update
SimpleGuarddev-mode behavior to skip project-root walking and to prefer dev-mode identity resolution over legacyagent-card.jsonloading. - Add a lazy
guardproperty on theCapiscIO.connect()return type (AgentIdentity) for convenient access to aSimpleGuardinstance. - Bump package/runtime version from 2.7.1 → 2.7.2.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pyproject.toml | Bumps distribution version to 2.7.2. |
| capiscio_sdk/simple_guard.py | Adjusts dev-mode root/identity resolution to avoid requiring agent-card.json. |
| capiscio_sdk/connect.py | Adds AgentIdentity.guard convenience property for SimpleGuard access. |
| capiscio_sdk/init.py | Bumps runtime __version__ to 2.7.2. |
| @property | ||
| def guard(self) -> "SimpleGuard": | ||
| """Access the SimpleGuard instance for signing/verifying.""" | ||
| if self._guard is None: | ||
| from .simple_guard import SimpleGuard | ||
| self._guard = SimpleGuard( | ||
| agent_id=self.did or self.agent_id, | ||
| base_dir=str(self.keys_dir.parent), | ||
| ) | ||
| return self._guard |
| @property | ||
| def guard(self) -> "SimpleGuard": | ||
| """Access the SimpleGuard instance for signing/verifying.""" | ||
| if self._guard is None: | ||
| from .simple_guard import SimpleGuard | ||
| self._guard = SimpleGuard( | ||
| agent_id=self.did or self.agent_id, | ||
| base_dir=str(self.keys_dir.parent), | ||
| ) | ||
| return self._guard |
There was a problem hiding this comment.
Good point. The guard property now properly reuses the identity's key material (signing_kid, badge_token, keys_preloaded=True). I'll file a follow-up issue for adding unit test coverage for this property — it requires mocking the gRPC server which is better suited for integration tests.
Pass signing_kid, badge_token, and keys_preloaded to SimpleGuard so the guard reuses the same identity provisioned by connect() instead of creating an incompatible standalone instance.
|
Closing: duplicate of already-merged #72. Branch was erroneously re-pushed. |
DX Audit: SimpleGuard Dev Mode Improvements
Discovered during developer experience audit — new users hit errors when
agent-card.jsondoesn't exist yet.Changes
SimpleGuardindev_mode=Trueno longer requiresagent-card.jsonto exist (skips card loading)client.guardproperty onCapiscIOClientfor convenient access to the SimpleGuard instance4 files, +27/-14